/**
 * Copyright (c) 2014, 2017, Oracle and/or its affiliates.
 * The Universal Permissive License (UPL), Version 1.0
 */
"use strict";
/*
 Copyright 2013 jQuery Foundation and other contributors
 Released under the MIT license.
 http://jquery.org/license
*/
define(["ojs/ojcore","jquery","ojs/ojcomponentcore","ojs/ojconveyorbelt","ojs/ojmenu","jqueryui-amd/widgets/sortable","ojs/ojtouchproxy"],function(a,g){(function(){var b={cut:"ojtabscut","paste-before":"ojtabspastebefore","paste-after":"ojtabspasteafter",remove:"ojtabsremove"},c={cut:"labelCut","paste-before":"labelPasteBefore","paste-after":"labelPasteAfter",remove:"labelRemove"};a.Ra("oj.ojTabs",g.oj.baseComponent,{widgetEventPrefix:"oj",delay:300,options:{selected:0,disabledTabs:null,truncation:"auto",
selectOn:"click",orientation:"horizontal",edge:"top",removable:!1,reorderable:!1,beforeSelect:null,select:null,beforeDeselect:null,deselect:null,beforeRemove:null,remove:null,beforeReorder:null,reorder:null,optionChange:null},_ComponentCreate:function(){var a=this.options;this._super();this.t_=!1;this.Tj=!0;this.NW(a.edge);this.V$=0==this.element.children("ul").length;this.xsa();this.wba();this.Ia={};this.Ia.Dh=!1;this.Ia.EG=[];this.Ia.mf=null;this.Ia.vk=null;this.Ia.ql=null;this.Ss();this.Of();a=
this.d8(a.selected);void 0===a&&(a=0);this.aD(a);this.Tj=void 0},aD:function(a,b){this.CK(a)&&(a=this.LT(a));this.mC(void 0===a?void 0:g(this.Ub[a]),b)},ph:function(a,b,c){if(this.wza(b.target)&&(!this.iX||!this.iX.HL)){var h="keyboard"===c;if("contextmenu"==b.type||h||"touch"==c){var k=g(b.target).closest("li");a={launcher:k};this.Ia.tab=h?this.bb:a.launcher;if(this.Ia.tab){if(this.Ia.DG){if(((h=k.hasClass("oj-disabled"))||0==this.Qy(k).length)&&1==this.Ia.mf.children().length){b.preventDefault();
return}h||!this.lV(k)?this.Ia.DG.addClass("oj-disabled"):this.Ia.DG.removeClass("oj-disabled")}if(this.Ia.vk||this.Ia.ql)k=!this.Ia.sM,this.Ia.vk.hasClass("oj-disabled")!=k&&(k?(this.Ia.vk.addClass("oj-disabled"),this.Ia.ql.addClass("oj-disabled")):(this.Ia.vk.removeClass("oj-disabled"),this.Ia.ql.removeClass("oj-disabled")),this.Ia.mf.ojMenu("refresh"));this.qh(b,c,a)}else b.preventDefault()}}},WEa:function(a){if(!this.K9(a)){var b=g(this.document[0].activeElement).closest("li"),c=this.mD(),h=c.index(b),
k=c.length;switch(a.keyCode){case g.ui.keyCode.RIGHT:case g.ui.keyCode.DOWN:h=(h+1)%k;break;case g.ui.keyCode.UP:case g.ui.keyCode.LEFT:h=((0==h?k:h)-1)%k;break;case g.ui.keyCode.END:h=k-1;break;case g.ui.keyCode.HOME:h=0;break;case 46:(b=this.bb)&&0<this.Qy(b).length&&(a.preventDefault(),this.hL(b,null,a));return;default:return}a.preventDefault();clearTimeout(this.YFa);var l=g(c[h]);l.focus();if(!a.ctrlKey){b.attr("aria-selected","false");l.attr("aria-selected","true");var m=this;this.YFa=this._delay(function(){m&&
m.Ub&&m.mC(l,a)},this.delay)}}},eBa:function(a){g(a.target).closest(".oj-tabs-selected").attr("id")===this.element.children(".oj-tabs-selected").attr("id")&&!this.K9(a)&&a.ctrlKey&&a.keyCode===g.ui.keyCode.UP&&(a.preventDefault(),this.bb.focus())},K9:function(a){var b=this.RT();if(a.ctrlKey&&a.keyCode===g.ui.keyCode.PAGE_UP)return this.mC(this.p7(b,!1)),!0;if(a.ctrlKey&&a.keyCode===g.ui.keyCode.PAGE_DOWN)return this.mC(this.p7(b,!0)),!0},CK:function(a){return 0<=a&&a<this.Ub.length?g(this.Ub[a]).hasClass("oj-disabled"):
!1},p7:function(a,b){var c=this.mD(),h=c.index(this.Ub[a]),k=c.length,c=g(c[b?(h+1)%k:((0==h?k:h)-1)%k]);c.focus();return c},LT:function(a){for(var b=a+1,c=this.Ub.length-1;b<=c;){if(!this.CK(b))return b;b++}for(b=a-1;0<=b;){if(!this.CK(b))return b;b--}},wd:function(){return"top"==this.options.edge||"bottom"==this.options.edge},_setOption:function(a,b,c){"selected"===a?(b=this.TJ(b),void 0!==b&&this.mC(b)):"disabledTabs"===a?(null===b&&(b=[]),Array.isArray(b)&&(this.hda(b),a=this.RT(),this.CK(a)&&
this.aD(a),this.refresh())):"removable"===a||"truncation"===a?b!=this.options[a]&&(this._super(a,b,c),this.refresh()):"reorderable"===a?b!==this.options.reorderable&&(this._super(a,b,c),this.refresh()):"orientation"===a?this.KS||(a=this.bba(b))&&this.NW(a)&&this.refresh():"edge"===a?this.NW(b)&&(this.KS=!0,this._super(a,b,c),this.refresh()):"selectOn"===a?(this.Nz(!0),this._super(a,b,c),this.Bn()):("contextMenu"===a&&(this.gv(),b&&this.Ss(b)),this._super(a,b,c),"translations"===a&&c&&"removeCueText"===
c.subkey&&this.Rd&&this.Qy(this.Rd).attr("aria-label",b?b.removeCueText:""))},refresh:function(){this._super();this.wba();this.Of();if(!this.element.children(".oj-tabs-selected").length){var a=this.LT(-1);0<=a&&this.aD(a)}},Of:function(){var a=this.element.children(".oj-tabs-selected");this.bb=a.length?this.Rd.children(".oj-selected"):g();this.Pra();this.Bn();this.Ub.not(this.bb).attr({"aria-selected":"false",tabIndex:"-1"});this.ol.not(this.Ms(this.bb)).hide().attr({"aria-expanded":"false","aria-hidden":"true"});
this.bb.length?(this.bb.addClass("oj-selected").attr({"aria-selected":"true",tabIndex:"0"}),a.show().attr("aria-expanded","true").removeAttr("aria-hidden")):g(this.Ub[0]).attr("tabIndex","0");this.wd()&&(0<this.Ub.length?(this.rFa(),this.ppa()):this.YT(),this.tpa());void 0===this.options.selected||0==this.RT()?this.element.addClass("oj-first-child-selected"):this.element.removeClass("oj-first-child-selected");this.tEa()},ppa:function(){var a=this.Rd.uniqueId().attr("id");this.Xq=this.YT().parent().ojConveyorBelt({orientation:"horizontal",
contentParent:"#"+a});a=this.Xq.parent();if(a.hasClass("oj-tabs-conveyorbelt-wrapper")){var b="0 1 "+this.Gua()+"px";a.css("flex",b);a.css("-webkit-flex",b);a.css("-ms-flex",b)}},wba:function(){var a=this,b=this.options.edge;this.v6();this.wsa();this.Rd=this.element.children("ul").addClass("oj-tabs-nav oj-helper-clearfix").attr("role","tablist");var c=this.Rd.index(),h,k;this.element.children(".oj-tabs-facet").each(function(){var a=g(this);a.index()<c?(a.addClass("oj-start"),h=a):(k||(k=a),a.removeClass("oj-start"))});
this.element.children(".oj-tabs-panel");"start"==b||"top"==b?h?h.after(this.Rd):this.element.prepend(this.Rd):k?k.before(this.Rd):this.element.append(this.Rd);this.Ub=g();this.ol=g();this.Rd.children("li").each(function(){var b=g(this).addClass("oj-tabs-tab").attr({role:"tab",tabIndex:"-1"}).removeAttr("aria-hidden"),c=b.children();c.addClass("oj-tabs-tab-content");c=c.children();c.addClass("oj-tabs-anchor").attr({role:"presentation",tabIndex:"-1"});c.children().addClass("oj-tabs-title").removeAttr("aria-hidden");
a.Ub=a.Ub.add(b);var c=c.uniqueId().attr("id"),e=b.attr("data-content"),f=a.element.find(a.jw(e));b.attr({"aria-controls":e,"aria-labelledby":c});a.ol=a.ol.add(f);f.attr("aria-labelledby",c).attr("role","tabpanel")});"start"!=b&&"end"!=b||a.Rd.addClass("oj-tabs-nav-root");this.Tj&&this.hda(this.options.disabledTabs)},Bn:function(){var b=this,c={keydown:this.WEa},f=this.options.selectOn,h=!1;f&&g.each(f.split(" "),function(f,g){"click"==g&&(h=!0);a.D.qN(g)&&(c[g]=b.aJ)});var k=this.mD();this._on(k,
c);h||this._on(k,{click:function(a){a.preventDefault()}});this.ol.on("keydown"+this.eventNamespace,this.eBa.bind(this));if(this.options.removable){var f={click:this.FCa},l=this.Qy(k);this._on(l,f);this.We(l);this.Gk(l)}this._focusable({element:k,applyHighlight:!0});this.We(k);this.Gk({element:k,afterToggle:function(a){"mousedown"===a&&k.filter(".oj-focus-highlight").blur()}})},Nz:function(a){var b=this.mD();a||this.Zu(this.Qy(b));this.Zu(b);this.ol&&this.ol.off("keydown"+this.eventNamespace)},aJ:function(a,
b){var c=this.bb,h=g(a.currentTarget).closest("li"),k=c&&h[0]===c[0],l=this.Ms(h),m=c&&c.length?this.Ms(c):g(),c={fromTab:c,fromContent:m,toTab:h,toContent:l};a.preventDefault();var r=b?b:a;h.hasClass("oj-disabled")||this.t_||k||m&&m.length&&!1===this._trigger("beforeDeselect",r,c)||!this.Tj&&!1===this._trigger("beforeSelect",r,c)||(this.Tj?this.options.selected=this.UJ(h):this.option("selected",this.UJ(h),{_context:{originalEvent:r,kb:!0}}),this.bb=h,l.addClass("oj-tabs-selected"),m&&m.length&&m.removeClass("oj-tabs-selected"),
this.iFa(r,c))},iFa:function(b,c){var f=c.toTab.closest("li"),h=c.toContent,k=c.fromContent;this.t_=!0;var l=c.fromTab.closest("li").removeClass("oj-selected");k.hide();0<k.length&&a.Components.ju(k[0]);f.addClass("oj-selected");this.wd()&&0<this.Ub.length&&(0==f.index()?this.element.addClass("oj-first-child-selected"):this.element.removeClass("oj-first-child-selected"));h.show();0<h.length&&a.Components.Mr(h[0]);this.t_=!1;this.Tj||(this._trigger("deselect",b,c),this._trigger("select",b,c));k.attr({"aria-expanded":"false",
"aria-hidden":"true"});l.attr("aria-selected","false");h.length&&k.length?l.attr("tabIndex","-1"):h.length&&this.Ub.filter(function(){return"0"===g(this).attr("tabIndex")}).attr("tabIndex","-1");h.attr("aria-expanded","true").removeAttr("aria-hidden");f.attr({"aria-selected":"true",tabIndex:"0"})},mC:function(a,b){if(void 0!==a){var c;this.bb&&a[0]===this.bb[0]||(c=a.find(".oj-tabs-anchor")[0],this.aJ({target:c,currentTarget:c,preventDefault:g.noop},b))}},Pra:function(){if(this.options.removable&&
this.wd()){var a=this.F("removeCueText"),b=this;this.mD().each(function(c){if(b.lV(g(this))){var h=g(this).find("\x3e :first-child");h.addClass("oj-removable");c="ojtabs-id_rm_"+c;g(this).attr("aria-describedby",c);g("\x3ca href\x3d'#'\x3e").addClass("oj-tabs-icon oj-component-icon oj-clickable-icon-nocontext oj-tabs-close-icon").attr({id:c,tabIndex:"-1","aria-label":a,role:"presentation"}).appendTo(h)}})}},mD:function(){return g(this.Ub.not(".oj-disabled"))},Qy:function(a){return a.find(".oj-tabs-close-icon")},
v6:function(){this.Ub&&this.Nz();this.T9&&(a.D.xm(this.element[0],this.Og),this.T9=!1,this.OV=void 0);this.XW&&(a.D.jf()&&this.gea(),this.Rd.sortable("instance")&&this.Rd.sortable("destroy"),this.XW=void 0);var b=this.element.children(".oj-tabs-nav-root"),c=!b.hasClass("oj-tabs-nav");if(this.Ub&&(this.Qy(this.Ub).remove(),b.length)){var f=b,h=!0,k=this.Rd;b.children().each(function(){var a=g(this);if(a.hasClass("oj-tabs-conveyorbelt-wrapper"))a=k;else if(!a.hasClass("oj-tabs-facet"))return;h=!1;f.after(a);
f=a});h&&c&&b.after(k)}this.Xq&&(this.Xq.ojConveyorBelt("destroy"),this.Xq.remove(),this.bb=this.Xq=null);c&&b.remove();this.Rd=this.Ub=null},_destroy:function(){this.gv();this.wd()?this.element.removeClass("oj-tabs oj-component oj-tabs-horizontal oj-tabs-top oj-tabs-bottom oj-first-child-selected"):this.element.removeClass("oj-tabs oj-component oj-tabs-vertical oj-tabs-start oj-tabs-end oj-helper-clearfix");var a=this,b,c,h,k;this.Ub.each(function(l){b=g(this);b.removeAttr("tabIndex").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-controls").removeAttr("aria-disabled").removeAttr("aria-describedby").removeAttr("role").removeAttr("data-content").removeClass("oj-active oj-disabled oj-selected oj-tabs-gen-id oj-tabs-tab").removeUniqueId().css("display",
"");c=b.children("div").removeClass("oj-tabs-tab-content");h=c.children("a").removeClass("oj-tabs-anchor").removeAttr("tabIndex").removeAttr("role");k=h.children();k.removeClass("oj-tabs-title").removeAttr("aria-hidden");a.V$?k.prependTo(a.ol.get(l)):c.hasClass("oj-tabs-gen-div")&&h.hasClass("oj-tabs-gen-a")?(k.prependTo(b),c.remove()):h.hasClass("oj-tabs-gen-a")?(k.prependTo(c),h.remove()):c.hasClass("oj-tabs-gen-div")&&(h.prependTo(b),c.remove())});var l=this.Rd;this.v6();l.removeAttr("tabIndex").removeAttr("role").removeClass("oj-tabs-nav oj-tabs-nav-root oj-helper-clearfix").removeUniqueId();
this.V$&&l.remove();this.ol.each(function(){g(this).removeAttr("tabIndex").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("role").removeClass("oj-active oj-tabs-selected oj-tabs-gen-id oj-tabs-panel").removeUniqueId().css("display","")});this.element.children(".oj-tabs-facet").removeClass("oj-start")},lV:function(a){var b=this.options.removable;return b&&(!Array.isArray(b)||-1<b.indexOf(a.attr("id")))},hL:function(a,b,c){if(this.lV(a)){var h=
this.Ms(a),k={tab:a,content:h};c=c?c:b?b:{target:a,currentTarget:a,preventDefault:g.noop};if(a&&!1!==this._trigger("beforeRemove",c,k)){b&&b.preventDefault();var l;a.hasClass("oj-selected")&&(b=this.LT(this.Ub.index(a)),void 0===b?(this.bb=void 0,l=-1):l=g(this.Ub[b]).attr("data-content"));this.Nz();this.Ub=this.Ub.not(a);a.remove();h.remove();this.GX();this.refresh();-1===l?this.option("selected",void 0,{_context:{originalEvent:c,kb:!0}}):l&&(a=this.TJ(l))&&(this.aD(this.Ub.index(a),c),this.option("selected",
this.UJ(a),{_context:{originalEvent:c,kb:!0}}));this._trigger("remove",c,k)}}},FCa:function(a,b){this.hL(g(a.currentTarget).closest("li"),a,b)},removeTab:function(a){if("string"!==typeof a)throw Error("'"+a+"' is not a tab id");this.hL(this.TJ(a),null,null)},cM:function(a,b){var c;if("li"==a.prop("tagName").toLowerCase()){c=a;var g=c.children("div");1==g.length&&g.hasClass("oj-tabs-tab-content")?(g=g.children("a"),1!=g.length&&(c.wrapInner("\x3ca href\x3d'#'\x3e\x3c/a\x3e"),g.addClass("oj-tabs-gen-a"))):
(g=c.wrapInner("\x3cdiv\x3e\x3ca href\x3d'#'\x3e\x3c/a\x3e\x3c/div\x3e").children(),g.addClass("oj-tabs-gen-div oj-tabs-tab-content"),g.children().addClass("oj-tabs-gen-a"))}else c=a.wrap("\x3cli\x3e\x3cdiv\x3e\x3ca href\x3d'#'\x3e\x3c/a\x3e\x3c/div\x3e\x3c/li\x3e").parent().parent().parent(),c.addClass("oj-tabs-gen-li"),c.children().addClass("oj-tabs-gen-div oj-tabs-tab-content");b&&c.attr("data-content",b);return c},addTab:function(a){var b,c,h=-1;a.tab&&a.content?(c=a.content,b=this.cM(a.tab,this.YJ(c)),
void 0!==a.index&&(h=a.index)):(c=a,b=this.cM(g(a).find("\x3e :first-child"),this.YJ(c)));a=this.element.children(".oj-tabs-nav-root");a=a.hasClass("oj-tabs-nav")?a:a.length?a.find(".oj-tabs-nav"):this.element.children(".oj-tabs-nav");var k=!1;a.length||(a=g("\x3cul\x3e"),k=!0);k&&a.prependTo(this.element);0<=h&&h<a.children().length?(h=a.children(":eq("+h+")"),a=this.element.children(this.jw(h.attr("aria-controls"))),h.before(b),a.before(c)):(b.appendTo(a),c.appendTo(this.element));this.refresh();
0==this.bb.length&&this.aD(0);b[0].scrollIntoView(!1)},wEa:function(){this.iX=a.Fg.Pea(this.Rd)},gea:function(){a.Fg.Cja(this.Rd)},tEa:function(){if(this.options.reorderable){var b=this;a.D.jf()&&this.wEa();this.Rd.sortable({axis:b.wd()?"x":"y",distance:10,stop:function(a,c){var g=c.item;b.G6(a,g,g.prev())||b.Rd.sortable("cancel")}});this.XW=!0}else this.gea(),this.XW=!1},Yf:function(a,b){var c=b.edge;this.KS="top"==c||"bottom"==c||"start"==c||"end"==c;this._super(a,b)},bba:function(a){return"horizontal"==
a?"top":"vertical"==a?"start":null},NW:function(a){if(this.Tj&&!this.KS||!a)a=this.bba(this.options.orientation);var b=this.options.edge;this.element.removeClass("oj-tabs-top oj-tabs-bottom oj-tabs-start oj-tabs-end");switch(a){case "top":case "bottom":!this.ol||"start"!=b&&"end"!=b||this.element.removeClass("oj-tabs-vertical oj-helper-clearfix");this.element.addClass("oj-tabs oj-component oj-tabs-horizontal");"bottom"==a?this.element.addClass("oj-tabs-bottom"):this.element.addClass("oj-tabs-top");
this.Tj?this.options.orientation="horizontal":"horizontal"!=this.options.orientation&&this.option("orientation","horizontal",{_context:{kb:!0},changed:!0});break;case "start":case "end":!this.ol||"top"!=b&&"bottom"!=b||this.element.removeClass("oj-tabs-horizontal");this.element.addClass("oj-tabs oj-component oj-tabs-vertical oj-helper-clearfix");"end"==a?this.element.addClass("oj-tabs-end"):this.element.addClass("oj-tabs-start");this.Tj?this.options.orientation="vertical":"vertical"!=this.options.orientation&&
this.option("orientation","vertical",{_context:{kb:!0},changed:!0});break;default:return!1}this.Tj?this.options.edge=a:this.options.edge!=a&&this.option("edge",a,{_context:{kb:!0},changed:!0});return!0},YT:function(){var a=this.Rd.parent();a.hasClass("oj-tabs-conveyor")||(a=this.Rd.wrap("\x3cdiv\x3e").parent().addClass("oj-tabs-conveyor"),(0<this.element.children(".oj-tabs-facet").length?a.wrap("\x3cdiv\x3e").wrap("\x3cdiv\x3e").parent().parent().addClass("oj-tabs-conveyorbelt-wrapper"):a).wrap("\x3cdiv\x3e").parent().addClass("oj-tabs-nav-root").uniqueId().attr("id"));
return a},LMa:function(a){0>a.id.indexOf("ojtabs-id_")&&g(a).attr("id","ojtabs-id_"+a.id)},getNodeBySubId:function(a){if(null==a)return this.element?this.element[0]:null;var b=a.subId;a=a.index;if("oj-conveyorbelt"!=b&&("number"!==typeof a||0>a||a>=this.ol.length))return null;switch(b){case "oj-conveyorbelt":return this.Xq?this.Xq[0]:null;case "oj-tabs-panel":return this.Ms(this.Ub[a])[0];case "oj-tabs-tab":return this.Ub[a];case "oj-tabs-title":return g(this.Ub[a]).find(".oj-tabs-title")[0];case "oj-tabs-close-icon":case "oj-tabs-close":return g(this.Ub[a]).find(".oj-tabs-close-icon")[0]}return null},
getSubIdByNode:function(a){for(var b=[],c=0;c<this.Ub.length;c++)b.push(this.Ms(this.Ub[c])[0]);for(var g=c=-1,k=a;k;){if(this.Xq&&k===this.Xq[0])return{subId:"oj-conveyorbelt"};c=Array.prototype.indexOf.call(this.Ub,k);if(-1!=c)break;g=b.indexOf(k);if(-1!=g)return{subId:"oj-tabs-panel",index:g};k=k.parentElement}if(-1!=c)for(b=this.getNodeBySubId({subId:"oj-tabs-title",index:c}),g=this.getNodeBySubId({subId:"oj-tabs-close",index:c}),k=a;k;){if(k===b)return{subId:"oj-tabs-title",index:c};if(k===g)return{subId:"oj-tabs-close",
index:c};if(k===this.Ub[c])return{subId:"oj-tabs-tab",index:c};k=k.parentElement}return null},Gua:function(){return this.OV+10},W8:function(){var a=this.element.find(".oj-tabs-conveyorbelt-wrapper");return a.length?a[0].clientWidth:this.element[0].clientWidth},W$:function(){return this.OV>this.W8()},Vva:function(){var a=Math.floor(this.W8()/this.Ub.length);this.options.removable&&(a-=28);return a},s4:function(){var a=this.Vva();this.Rd.find(".oj-tabs-title").each(function(){g(this).css("max-width",
""+a+"px").addClass("oj-tabs-title-overflow")})},GCa:function(){this.Rd.find(".oj-tabs-title").each(function(){g(this).css("max-width","").removeClass("oj-tabs-title-overflow")})},rNa:function(){},Lg:function(){this.aaa()&&(this.W$()?this.s4():this.GCa())},aaa:function(){return"auto"==this.options.truncation||"progressive"==this.options.truncation},rFa:function(){this.wd()&&0<this.Ub.length&&(null==this.Og&&(this.Og=this.Lg.bind(this)),a.D.$k(this.element[0],this.Og),this.T9=!0,this.OV=this.YT()[0].scrollWidth,
this.aaa()&&this.W$()&&this.s4())},hq:function(){this._super();this.refresh()},gq:function(){this._super();this.refresh()},Kj:function(a){return g("\x3ca\x3e").text(this.F(c[a])).attr("href","#").wrap("\x3cli\x3e").parent().attr("id",b[a]).addClass("oj-menu-item")},oAa:function(a){if(!a||!a.length)return!1;this.Ia.sM=a},Haa:function(a,b,c){if(!b||!b.length||!this.Ia.sM)return!1;var g=this.Ia.sM;this.Ia.sM=!1;this.G6(a,g,b,c)},pAa:function(a,b){if(!b||!b.length)return!1;this.hL(b,null,a)},Sk:function(a,
b){var c=b?b.item.attr("id"):void 0;"ojtabscut"===c?this.oAa(this.Ia.tab):"ojtabspastebefore"===c?this.Haa(a,this.Ia.tab,!0):"ojtabspasteafter"===c?this.Haa(a,this.Ia.tab,!1):"ojtabsremove"===c&&this.pAa(a,this.Ia.tab)},Ss:function(a){if(a=a||this.options.contextMenu){if("function"==g.type(a)){try{a=a()}catch(b){a=null}g.type(a)}a&&g(a).length&&(this.options.contextMenu=a)}this.Ia.Dh=!!a;this.ps()},eI:function(a,b,c){-1==b.indexOf(c)&&(b=this.Kj(c),a.append(b),this.Ia.EG.push(b))},ps:function(){var a=
g(this.options.contextMenu);if(0!=a.length||this.options.reorderable||this.options.removable){var b=this;if(0==a.length){var f=this.options.reorderable?"labelReorder":c.remove,h=this.element.uniqueId().attr("id")+"contextmenu",a=g("\x3cul\x3e");a.css("display","none").attr("id",h).attr("aria-label",this.F(f));g(document.body).append(a);a.ojMenu();this.options.contextMenu=this.jw(h)}var k=[];a.find("[data-oj-command]").each(function(){if(0===g(this).children("a").length){var a=g(this).attr("data-oj-command").slice(8);
g(this).replaceWith(b.Kj(a));g(this).addClass("oj-menu-item");k.push(a)}});this.options.reorderable&&(this.eI(a,k,"cut"),this.eI(a,k,"paste-before"),this.eI(a,k,"paste-after"),this.Ia.vk=a.find("#ojtabspastebefore"),this.Ia.ql=a.find("#ojtabspasteafter"));this.options.removable&&(this.eI(a,k,"remove"),this.Ia.DG=a.find("#ojtabsremove"));this.Ia.mf=a;a.ojMenu("refresh");a.on("ojselect",g.proxy(this.Sk,this))}},gv:function(){var a=this.Ia;if(a&&a.mf){a.mf.off("ojselect");a.Dh||(a.mf.ojMenu("destroy"),
a.mf.remove());if(a.EG)for(;0<a.EG.length;)a.EG.pop().remove();a.mf=null}a.vk=null;a.ql=null;a.DG=null},G6:function(a,b,c,g){var k=this.Ms(b),l={tab:b,content:k};if(!1===this._trigger("beforeReorder",a,l))return!1;var m=this.Ub.index(b);if(c.length){if(this.Ub.index(c)==m)return!0;m=this.Ms(c);g?(c.before(b),m.before(k)):(c.after(b),m.after(k))}else if(0<this.Ub.length){if(0==m)return!0;this.Ub.first().before(b);this.ol.first().before(k)}this.GX();this.refresh();c.blur();b.focus();this._trigger("reorder",
a,l);return!0},Dca:function(a){return a?a.replace(/[#!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$\x26"):""},jw:function(a){return a?"#"+this.Dca(a):""},Ms:function(a){return this.element.find(this.jw(g(a).attr("aria-controls")))},YJ:function(a){var b=a.attr("id");b||(b=a.uniqueId().attr("id"),a.addClass("oj-tabs-gen-id"));return b},TJ:function(a){a=this.d8(a);if(-1!==a)return g(this.Ub[a])},d8:function(b){var c=-1;"number"===typeof b?0<=b&&b<this.Ub.length&&(c=b):"string"===typeof b&&(b=this.Dca(b),a.D.qN(b)&&
(b=this.element.find(this.jw(b)),b.length&&(c=this.Ub.index(b),-1==c&&(c=this.ol.index(b)))));return c},RT:function(){var a=this.options.selected;return"number"===typeof a?a:this.Ub.index(g(this.jw(a)))},UJ:function(a){if(a){var b=a.attr("id");return b?b:this.Ub.index(a)}},hda:function(a){var b=(this.Rd?this.Rd:this.element.children("ul")).children("li");b.removeClass("oj-disabled").removeAttr("aria-disabled");var c=[];if(a&&0<a.length)for(var g,k,l=0;l<a.length;l++)if(k=this.TJ(a[l]))k.addClass("oj-disabled"),
k.attr("aria-disabled","true"),k.find(".oj-tabs-anchor").removeAttr("href"),g=k.attr("id"),c.push(g?g:b.index(k));this.GX(c)},GX:function(b){if(!b){b=[];var c=this;this.Rd.children().each(function(){var a=g(this);a.hasClass("oj-disabled")&&b.push(c.UJ(a))})}a.b.A5(this.options.disabledTabs,b)||(this.Tj?this.options.disabledTabs=b:this.option({disabledTabs:b},{_context:{kb:!0,Cd:!0},changed:!0}))},wza:function(a){var b=!1;this.Ub.each(function(){if(this===a||g.contains(this,a))return b=!0,!1});return b},
wsa:function(){var a=this.D7(),b=this,c=this.element.children("ul");0<c.length&&c.children("li").each(function(c){b.cM(g(this),a[c])})},xsa:function(){var a=this.element.children("ul");if(0==a.length){var b=this,c=this.D7(),a=g("\x3cul\x3e");this.element.children().each(function(h){b.cM(g(this).find("\x3e :first-child"),c[h]).appendTo(a)});a.prependTo(this.element)}},tpa:function(){var a=this.element.children(".oj-tabs-nav-root"),b=this,c=a.children(".oj-tabs-conveyorbelt-wrapper");a.index();this.element.children(".oj-tabs-facet").each(function(){var h=
g(this),k=b.YJ(h);0==a.find(b.jw(k)).length&&(h.hasClass("oj-start")?c.before(h):h.appendTo(a))})},D7:function(){var a=[],b=this;this.element.children(":not(ul):not(.oj-tabs-facet)").each(function(){var c=g(this);c.addClass("oj-tabs-panel");a.push(b.YJ(c))});return a}})})();a.Components.Xa("ojTabs","baseComponent",{properties:{disabledTabs:{type:"Array"},edge:{type:"string"},orientation:{type:"string"},removable:{type:"boolean|Array"},reorderable:{type:"boolean"},selected:{type:"string|number"},selectOn:{type:"string"},
truncation:{type:"string"}},methods:{addTab:{},refresh:{},removeTab:{}},extension:{_widgetName:"ojTabs"}});a.Components.register("oj-tabs",a.Components.getMetadata("ojTabs"))});